package br.com.fidalgotecnologia.layar.json;

import org.json.JSONObject;

import br.com.fidalgotecnologia.layar.entity.Layer;

public class LayerJson {
	private Layer layer;
	public LayerJson(Layer layer){
		this.layer = layer;
	}
	@Override
	public String toString() {
		String retorno = null;
		JSONObject json = new JSONObject();
		try {
			json.put( "layer",layer.getLayer());
			json.put( "hotspots",new HotSpotJsonArray(layer.getHotSpots()).toJSONArray());
			json.put( "errorCode",0);
			json.put( "errorString","ok");
			retorno = json.toString();
		} catch (Exception  e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return retorno;
	}

}
